package com.power.sifa.netlogin.controller;

import cn.hutool.core.util.ObjectUtil;
import com.plf.common.domain.ResponseDTO;
import com.power.sifa.approve.model.pageInfo.Apl_arrive_personPageInfo;
import com.power.sifa.netlogin.api.INet_userCommonFeign;
import com.power.sifa.netlogin.model.Net_user;
import com.power.sifa.netlogin.service.Net_userCommonService;
import com.power.sifa.netlogin.service.Net_userService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiongzhiwen
 * @version 1.0
 * @description: 网申端公共业务接口
 * @date 2024/4/25 10:50
 */

@Slf4j
@RestController
@Api(value = "Net_userCommonController", tags = {"网申端公共业务类"})
@RequiredArgsConstructor
public class Net_userCommonController implements INet_userCommonFeign {


    private final Net_userService net_userService;

    private final Net_userCommonService net_userCommonService;


    @Override
    public ResponseDTO getArriveList(String userid, Apl_arrive_personPageInfo pageInfo) {
        Assert.notNull(userid, "userid不能为空");
        // 查询当前的网申端用户信息
        Net_user user = net_userService.getById(userid);
        if (ObjectUtil.isNotNull(user)) {
            String phone = user.getPhone();
            pageInfo.setF_phone(phone);
            return ResponseDTO.succData(net_userCommonService.getArrivePage(pageInfo));
        } else {
            return ResponseDTO.wrap(500, "登录用户信息不存在");
        }
    }
}
